/*
* Copyright (c) 2007 by Kirill Kolodyazhniy.
* See the file "license.terms" for information on usage and redistribution.
*/

#ifndef M_RESOURCE_H
#define M_RESOURCE_H

#include "factory.h"
#include "refptr.h"
#include <string>

#ifdef _MSC_VER
#pragma warning(disable:4100)
#endif

namespace Engine
{
	/**
	*   Abstract class for resource managing.
	*/
	class Resource
	{
	public:
		Resource(const std::string& name)
			:m_name(name),m_loaded(false)
		{}
		const std::string& GetName()const {return m_name;}
		virtual ~Resource(){};
		virtual void Load() = 0;
		virtual void UnLoad() = 0;
		virtual void ReLoad()
		{
			UnLoad();
			Load();
		}
		bool IsLoaded(){return m_loaded;}

	protected:

		void SetLoaded(bool val){m_loaded = val;}

	private:
		std::string m_name;
		bool m_loaded;
	};

	/**
	*   Factory class for creating resources.
	*/
	class ResourceFactory: public Factory<Resource>
	{
	};
}

#endif
